package com.nbufe.command.demo3;

/**
 * @Author Zan
 * @Create 2024/6/12 14:18
 * @ClassName: Computer
 * @Description : 计算器
 */
public class Computer {

    private AbstractCommand command;

    public void setCommand(AbstractCommand command) {
        this.command = command;
    }

    public void execute(int value) {
        double i = command.compute(value);
        System.out.println("执行运算，结果：" + i);
    }

    public void revoke() {
        double i = command.revoke();
        System.out.println("执行撤销，结果：" + i);
    }

    public void resume() {
        double i = command.resume();
        System.out.println("执行恢复，结果：" + i);
    }
}
